package com.xbongbong.pro.statistic.pojo;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * logStash input配置文件实体类
 * @author zhouwq
 * @date 2019/5/13 10:20
 */

@Getter
@Setter
@ToString
public class LogStashInputPojo {

    /**
     * rabbitMQ 信息
     */
    private String host;
    /**
     * rabbitMQ 端口
     */
    private Integer port;
    /**
     * 登陆账号
     */
    private String user;
    /**
     * 登陆密码
     */
    private String password;
    /**
     * 通道名  默认bi
     */
    private String exchange;
    /**
     * 监听的mq的queue
     */
    private String queue;
    /**
     * queue是否持久化
     */
    private Boolean durable;
    /**
     * type内容可以自由定义，可作为标识
     */
    private String type;
    /**
     * 线程数
     */
    private Integer threads;

    /**
     * 虚拟地址
     */
    private String virtualHost;

    /**
     * routing key 路由键
     */
    private String key;

    public String getLogStashInput(){
        return "\trabbitmq {" + "\n" +
                "\t\thost => \"" + host + "\"\n" +
                "\t\tport => " + port + "\n" +
                "\t\tuser => \"" + user + "\"\n" +
                "\t\tpassword => \"" + password + "\"\n" +
                "\t\texchange => \"" + exchange + "\"\n" +
                "\t\tqueue => \"" + exchange + "." + queue + "\"\n" +
                "\t\tdurable => " + durable + "\n" +
                "\t\ttype => \"" + type + "\"\n" +
                "\t\tthreads => " + threads + "\n" +
                "\t\tvhost => \"" + virtualHost + "\"\n" +
                "\t\tkey => \"" + key + "\"\n" +
                "\t}";
    }

    public String getLogStashInputUpdate(){
        return "\trabbitmq {" + "\n" +
                "\t\thost => \"" + host + "\"\n" +
                "\t\tport => " + port + "\n" +
                "\t\tuser => \"" + user + "\"\n" +
                "\t\tpassword => \"" + password + "\"\n" +
                "\t\texchange => \"" + exchange + "\"\n" +
                "\t\tqueue => \"" + exchange + "." + queue + "_update\"\n" +
                "\t\tdurable => " + durable + "\n" +
                "\t\ttype => \"" + type + "_update\"\n" +
                "\t\tthreads => " + threads + "\n" +
                "\t\tvhost => \"" + virtualHost + "\"\n" +
                "\t\tkey => \"" + key + "_update\"\n" +
                "\t}";
    }
}
